package top.healthylife.gateway.platform.youshu.dto.api300223.res;

import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.experimental.Accessors;
import top.healthylife.basics.utils.exception.BusinessException;
import top.healthylife.gateway.platform.youshu.dto.api300223.res.bgt.YoushuResEnterpriseLitigationRelatedDetailBgtDto;
import top.healthylife.gateway.platform.youshu.dto.api300223.res.bzxr.YoushuResEnterpriseLitigationRelatedDetailBzxrDto;
import top.healthylife.gateway.platform.youshu.dto.api300223.res.cjws.YoushuResEnterpriseLitigationRelatedDetailCjwsDto;
import top.healthylife.gateway.platform.youshu.dto.api300223.res.fygg.YoushuResEnterpriseLitigationRelatedDetailFyggDto;
import top.healthylife.gateway.platform.youshu.dto.api300223.res.ktgg.YoushuResEnterpriseLitigationRelatedDetailKtggDto;
import top.healthylife.gateway.platform.youshu.dto.api300223.res.laxx.YoushuResEnterpriseLitigationRelatedDetailLaxxDto;
import top.healthylife.gateway.platform.youshu.dto.api300223.res.sfpm.YoushuResEnterpriseLitigationRelatedDetailSfpmDto;
import top.healthylife.gateway.platform.youshu.dto.api300223.res.sxbzxr.YoushuResEnterpriseLitigationRelatedDetailSxbzzrDto;
import top.healthylife.gateway.platform.youshu.dto.api300223.res.xjpg.YoushuResEnterpriseLitigationRelatedDetailXjpgDto;
import top.healthylife.gateway.platform.youshu.dto.api300223.res.zbaj.YoushuResEnterpriseLitigationRelatedDetailZbajDto;

import java.util.HashMap;
import java.util.Map;

/**
 * @author : GaoZeXi
 * @date 2021/8/8 14:43
 */
@Data
@Accessors(chain = true)
@ApiModel("动态返回类工厂")
public class YoushuDynamicResFactory {

    static Map<String, Class<? extends YoushuResEnterpriseLitigationRelatedDetailDto>> mapping = new HashMap<>(16);
    static {
        mapping.put("cpws", YoushuResEnterpriseLitigationRelatedDetailCjwsDto.class);
        mapping.put("ktgg", YoushuResEnterpriseLitigationRelatedDetailKtggDto.class);
        mapping.put("sfpm", YoushuResEnterpriseLitigationRelatedDetailSfpmDto.class);
        mapping.put("bgt", YoushuResEnterpriseLitigationRelatedDetailBgtDto.class);
        mapping.put("zhongben", YoushuResEnterpriseLitigationRelatedDetailZbajDto.class);
        mapping.put("laxx", YoushuResEnterpriseLitigationRelatedDetailLaxxDto.class);
        mapping.put("shixin", YoushuResEnterpriseLitigationRelatedDetailSxbzzrDto.class);
        mapping.put("fygg", YoushuResEnterpriseLitigationRelatedDetailFyggDto.class);
        mapping.put("xjpg", YoushuResEnterpriseLitigationRelatedDetailXjpgDto.class);
        mapping.put("zxgg", YoushuResEnterpriseLitigationRelatedDetailBzxrDto.class);
    }
    public static Class<? extends YoushuResEnterpriseLitigationRelatedDetailDto> getInstance(String type) {
            if(mapping.containsKey(type)){
                return mapping.get(type);
            }
            throw new BusinessException("dataType取值不在期望值之内");
    }
}
